package com.sg.business.model.dataset.work;

import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import com.sg.business.model.DummyModel;
import com.sg.business.model.IModelConstants;
import com.sg.business.model.Work;
import com.sg.widgets.commons.dataset.MasterDetailDataSetFactory;

public class OrgOrUserWorks extends MasterDetailDataSetFactory {

	public OrgOrUserWorks() {
		super(IModelConstants.DB, IModelConstants.C_WORK);
	}

	@Override
	public DBObject getQueryCondition() {
		if (master instanceof DummyModel) {
			return master.get_data();
		} else {
			return new BasicDBObject().append("_id", null);
		}
	}

	@Override
	public DBObject getSort() {
		return new BasicDBObject().append(Work.F_ROOT_ID, 1)
				.append(Work.F_PROJECT_ID, 1).append(Work.F_WORK_TYPE, 1);
	}

	@Override
	protected String getDetailCollectionKey() {
		return null;
	}
}
